package org.bbx.autoops.utils;

import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.auth.ICredential;

import com.huaweicloud.sdk.hss.v5.HssClient;
import com.huaweicloud.sdk.hss.v5.model.Host;
import com.huaweicloud.sdk.hss.v5.model.ListHostStatusRequest;
import com.huaweicloud.sdk.hss.v5.region.HssRegion;
import io.micrometer.common.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Component
public class HssUtil {


    @Value("${metric.config.region}")
    private String region;


    @Value("${hw.ak}")
    private String ak;

    @Value("${hw.sk}")
    private String sk;


    public List<Host> listHostStatus() {
        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        HssClient client = HssClient.newBuilder()
                .withCredential(auth)
                .withRegion(HssRegion.valueOf(region))
                .build();
        ListHostStatusRequest request = new ListHostStatusRequest();
        request.withEnterpriseProjectId("all_granted_eps");
        return client.listHostStatus(request).getDataList();

    }









}
